/*
** 2196.c
** 
** Made by (seakage2h)
** Login   <seakage2h@seakage2h-ubuntu>
** 
** Started on  Thu Sep 25 19:33:38 2008 seakage2h
** Last update Sun May 12 01:17:25 2002 Speed Blue
*/

/* #include "2196.h" */
#include <stdio.h>

int main()
{
     int i;
     static char b0, b1, b2, b3, tbdec, tbh, tbduo;

     for(i = 2992; i < 10000; i++){
	  /* compute decimal */
	  b3 = i / 1000;
	  b2 = ( i - b3 * 1000) / 100;
	  b1 = i % 100 / 10;
	  b0 = i % 10;
	  tbdec = b0 + b1 + b2 + b3;
	  /* compute duodecimal */
	  b3 = i / 1728;
	  b2 = ( i - b3 * 1728) / 144;
	  b1 = i % 144 / 12;
	  b0 = i % 12;
	  tbduo = b0 + b1 + b2 + b3;	  
	  b3 = i / 4096;
	  b2 = (i - b3 * 4096) / 256;
	  b1 = i % 256 / 16;
	  b0 = i % 16;
	  tbh = b0 + b1 + b2 + b3;
	  if (tbh == tbduo && tbduo == tbdec)
	       printf("%d\n", i);
     }

     return 0;
}
